<template>
  <el-card v-if="countData" shadow="never" header="今日运营" class="count-panel">
    <div class="count_box">
      <CountCardToday title="施工订单" :value="countData.user" />

      <CountCardToday title="来电咨询" :value="countData.devicesOnline" />

      <CountCardToday title="维权投诉" :value="countData.devices" />

      <CountCardToday title="安防警告" :value="countData.devicesOffline" />

      <CountCardToday title="新增设备" :value="countData.order" />

      <CountCardToday title="新增用户" :value="countData.archives" />

      <CountCardToday title="今日账单" :value="countData.orderConstruction" />

      <CountCardToday title="跌倒警告" :value="countData.archivesAudit" />

      <CountCardToday title="设备离线警告" :value="countData.bill" />
    </div>
  </el-card>
</template>

<script setup lang="ts">
import CountAPI, { CountDataModel } from "@/api/count";
import CountCard from "./count-card.vue";
import CountCardToday from "./count-card-today.vue";

const countData = ref<CountDataModel>();

onMounted(() => {
  fetchData();
});

function fetchData() {
  CountAPI.countData().then((res) => {
    countData.value = res;
  });
}
</script>

<style lang="scss" scoped>
.count_box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 15px;

  .icon {
    width: 40px;
    height: 40px;
  }
}
</style>
